<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@  taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="none">
    <meta name="author" content="Geofarry_Liang">
    <title>QueryTools System</title>
    <!-- Bootstrap core CSS -->
    <link href="/QueryTools/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/QueryTools/css/signin.css" rel="stylesheet">
    <style type="text/css">
    body {
	  padding-top: 70px;
	}
    </style>
    <script type="text/javascript">
        /**
        	增加一列
        */
    	function addOption(){
			var str ="<div class=\"form-group\">";
			str = str + "<select name=\"themeDetails.item\" class=\"form-control pull-left\" style=\"width:85%;\">";
			str = str + "<option value=\"name\">姓名</option>";
			str = str + "<option value=\"sex\">性别</option>";
			str = str + "<option value=\"age\">年龄</option>";
			str = str + "<option value=\"phone\">电话</option>";
			str = str + "<option value=\"address\">地址</option>";
			str = str + "<option value=\"email\">电子邮箱</option>";
			str = str + "</select>";
			str = str + "<a href=\"javascript:void(0);\" onclick=\"delTr(this)\" style=\"margin:4px;\" class=\"btn btn-primary\" role=\"button\">－</a>";
			str = str + "</div>";
			$("#theme .form-group").last().after(str);
		}
		/**
			删除tr
		*/
		function delTr(obj){
				$(obj).parent().remove();
		}
		/**
		重新排序
		*/
		function getSeque(){
			var num=0;
			$("#theme").find("select").each(function (){
				$(this).attr("name","themeDetails["+num+"].item");
				num=num+1;
			});
			if(confirm("确认提交吗？")){
				return true;
			}else{
				return false;
			}
		}
    </script>
  </head>
  <body>
    <c:import url="/front/front_head.jsp"></c:import>
    <div class="container">

      <form method="post" action="/QueryTools/theme/insertTheme" onsubmit="return getSeque()" id="theme" class="form-signin" role="form">
        <h2 align="center" class="form-signin-heading">主题管理</h2>
        <div class="form-group">
        	<label>主题名称</label>
        	<input type="text" name="name" class="form-control" placeholder="name" required autofocus>
        	<label>录入人</label>
        	<input type="text" name="author" class="form-control" placeholder="author" required autofocus>
        	<label>备注</label>
        	<input type="text" name="des" class="form-control" placeholder="des" required autofocus>
        	<label>录入时间</label>
        	<input type="text" name="inputTime" class="form-control" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"  placeholder="input time" required autofocus>
  		</div>
        <div class="form-group">
          <label>新增数据项</label> <a href="javascript:void(0);" onclick="addOption();"  class="btn btn-primary" role="button">＋</a>
        </div>
        <div class="form-group">	
          <select class="form-control" style="width:85%;">
			  <option value="name">姓名</option>
			  <option value="sex">性别</option>
			  <option value="age">年龄</option>
			  <option value="phone">电话</option>
			  <option value="address">地址</option>
			  <option value="email">电子邮箱</option>
			</select>
        </div>
        <div class="form-group">
          <select class="form-control pull-left" style="width:85%;">
			  <option value="name">姓名</option>
			  <option value="sex">性别</option>
			  <option value="age">年龄</option>
			  <option value="phone">电话</option>
			  <option value="address">地址</option>
			  <option value="email">电子邮箱</option>
			</select><a href="javascript:void(0);"  style="margin:4px;" class="btn btn-primary" role="button">－</a>
        </div>
        <div align="center">
        	<button class="btn btn-lg btn-primary" type="submit">保存</button>&nbsp;&nbsp;&nbsp;&nbsp;
        	<a href="javascript:window.close();" class="btn btn-lg btn-primary" role="button">关闭</a>
        </div>
      </form>
	
    </div> <!-- /container -->
    
  </body>
  <script src="/QueryTools/js/jquery-1.10.2.js"></script>
  <script src="/QueryTools/bootstrap/js/bootstrap.js"></script>
  <script src="/QueryTools/js/WdatePicker.js"></script>
</html>
